package face.pay.web.mch.terminal;

import face.pay.system.annotation.CurrentUser;
import face.pay.common.enterprise.service.IterminalBaseService;
import face.pay.entity.TerminalInfo;
import face.pay.entity.UserInfo;
import face.pay.util.ResultMessage;
import face.pay.util.page.PageData;
import face.pay.util.page.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/terminal")
public class TerminalController {

    @Autowired
    private IterminalBaseService iTerminalBaseService;

    @RequestMapping("/queryData")
    @ResponseBody
    public PageData data(TerminalInfo terminalInfo, @RequestParam Integer storeId, PageParam pageParam, @CurrentUser UserInfo userInfo){
        terminalInfo.setStoreId(storeId);
        return this.iTerminalBaseService.queryPage(terminalInfo,pageParam,userInfo);

    }

    @RequestMapping("/queryTerminalsByStoreId")
    @ResponseBody
    public PageData queryTerminalsByStoreId(TerminalInfo terminalInfo , @RequestParam("storeId")String storeId, PageParam pageParam, @CurrentUser UserInfo userInfo){
        terminalInfo.setStoreId(Integer.parseInt(storeId));
        System.out.print(storeId);
        return this.iTerminalBaseService.queryPage(terminalInfo,pageParam,userInfo);
    }

    @RequestMapping("/storeBing")
    @ResponseBody
    public ResultMessage storeBing(TerminalInfo terminalInfo, @CurrentUser UserInfo userInfo){
       ResultMessage resultMessage= iTerminalBaseService.storeBing(terminalInfo,userInfo);
       return resultMessage;
    }


}
